OpenShift Merge Robot [Tue, 7 Apr 2020 18:49:04 +0000 (20:49 +0200)]
Merge pull request #2058 from cgwalters/signing-cleanups
pull: Update key loading function to match error style
OpenShift Merge Robot [Tue, 7 Apr 2020 17:45:17 +0000 (19:45 +0200)]
Merge pull request #2061 from cgwalters/add-d4s
OWNERS: add d4s to reviewers
OpenShift Merge Robot [Tue, 7 Apr 2020 14:04:22 +0000 (16:04 +0200)]
Merge pull request #2060 from d4s/ostree_repo_pull_with_options-gpg_check
lib/repo-pull: fix GPG check while pulling remote
OpenShift Merge Robot [Tue, 7 Apr 2020 13:54:08 +0000 (15:54 +0200)]
Merge pull request #2044 from martinezjavier/duplicated-entries
grub2: Don't add menu entries if GRUB supports parsing BLS snippets
Colin Walters [Tue, 7 Apr 2020 13:07:55 +0000 (13:07 +0000)]
OWNERS: add d4s to reviewers
He did a lot of work on signing and will continue that.
Denis Pynkin [Mon, 6 Apr 2020 22:11:29 +0000 (01:11 +0300)]
lib/repo-pull: fix GPG check while pulling remote
If GPG support is disabled in a build time we should to check if any of
options "gpg_verify" or "gpg_verify_summary" is set to TRUE instead
of checking if they are passed via options while pulling from remote.
Fixed the failure with assertion of `ostree find-remotes --pull --mirror`
calling (`tests/test-pull-collections.sh`) if libostree has been compiled
without GPG support.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
OpenShift Merge Robot [Mon, 6 Apr 2020 20:33:43 +0000 (22:33 +0200)]
Merge pull request #2057 from cgwalters/test-sizes-error
tests/pull-sizes: Disable xattrs everywhere
OpenShift Merge Robot [Mon, 6 Apr 2020 20:18:49 +0000 (22:18 +0200)]
Merge pull request #2059 from cgwalters/commit-from-base-tree
commit: Add --base argument
OpenShift Merge Robot [Mon, 6 Apr 2020 19:54:13 +0000 (21:54 +0200)]
Merge pull request #2055 from cgwalters/gtkdoc-warnings
lib: Squash two gtk-doc warnings
Colin Walters [Sun, 5 Apr 2020 22:23:39 +0000 (22:23 +0000)]
commit: Add --base argument
I was trying to followup the `--selinux-policy-from-base` work
to add a `cosa build --fast=overlay` for coreos-assembler,
but hit on the fact that using e.g. `--owner-uid` disables
commit optimizations.
A while ago, https://github.com/ostreedev/ostree/pull/1643 landed
which optimized this for the case where no modifications are provided.
But, we really need the SELinux policy bits, and it's super convenient
to run `ostree commit` as non-root.
It's fairly surprising actually that it's taken us so long to
iterate on a good interface for this "commit changes on top of a base"
model. In practice, many nontrivial cases really end up needing
to do a (hardlink) checkout, and that case is optimized.
But for this coreos-assembler work I want to directly overlay onto
a commit object another commit object.
That previous PR above added exactly the API we need, so let's
expose it in the CLI.
What you can see happening in the test is that we provide
`--owner-uid 42`, but that only applies to directories/files
that were added in the commit.
And now that I look at this, I think what we really want here
is to avoid changing directories that exist in the base, but
eh; in practice the main use here is for `--owner-uid 0` while
committing as non-root; and that works fine with this since
the baseline uid will be zero as well.
Javier Martinez Canillas [Thu, 26 Mar 2020 16:20:08 +0000 (17:20 +0100)]
grub2: Don't add menu entries if GRUB supports parsing BLS snippets
This is another attempt to avoid having duplicated menu entries caused by
GRUB having support to parse BLS snippets and the 15_ostree script adding
menu entries as well.
The previous attempt was in commit
985a1410029 ("grub2: Exit gracefully if
the configuration has BLS enabled") but that lead to users not having menu
entries at all, due having an old GRUB version that was not able to parse
the BLS snippets.
This happened because the GRUB bootloader is never updated in the ESP as
a part of the OSTree upgrade transaction.
The logic is similar to the previous commit, the 15_ostree script exits if
able to determine that the bootloader can parse the BLS snippets directly.
But this time it will not only check that a BLS configuration was enabled,
but also that a /boot/grub2/.grub2-blscfg-supported file exists. This file
has to be created by a component outside of OSTree that also takes care of
updating GRUB to a version that has proper BLS support.
Colin Walters [Sun, 5 Apr 2020 18:22:49 +0000 (18:22 +0000)]
pull: Update key loading function to match error style
This code wasn't written with idiomatic GError usage; it's not standard
to construct an error up front and continually append to its
message. The exit from a function is usually `return TRUE`,
with error conditions before that.
Updating it to match style reveals what I think is a bug;
we were silently ignoring failure to parse key files.
Colin Walters [Sun, 5 Apr 2020 18:37:54 +0000 (18:37 +0000)]
tests/pull-sizes: Disable xattrs everywhere
I am getting SELinux xattrs committed in local development (inside
https://github.com/cgwalters/coretoolbox ), which
throws off the hardcoded sizes in this test.
OpenShift Merge Robot [Sat, 4 Apr 2020 17:46:12 +0000 (19:46 +0200)]
Merge pull request #1878 from d4s/wip/d4s/no_gpg
Alternative signing system
Colin Walters [Sat, 4 Apr 2020 17:05:56 +0000 (17:05 +0000)]
lib: Squash two gtk-doc warnings
Just noticed these while doing a build.
OpenShift Merge Robot [Wed, 1 Apr 2020 22:34:59 +0000 (00:34 +0200)]
Merge pull request #2051 from fkrull/repo_finder_avahi
lib: fix typo in function docs
Felix Krull [Wed, 1 Apr 2020 21:06:19 +0000 (23:06 +0200)]
lib: fix typo in function docs
OpenShift Merge Robot [Wed, 1 Apr 2020 13:18:06 +0000 (15:18 +0200)]
Merge pull request #2049 from cgwalters/sysroot-refactor
sysroot: Reorganize sysroot load code a bit
Colin Walters [Wed, 22 Jan 2020 19:44:31 +0000 (19:44 +0000)]
sysroot: Reorganize sysroot load code a bit
No functional changes; prep for a future patch
which will load the "live" deployment rather than
reading the bootloader configs.
OpenShift Merge Robot [Sun, 29 Mar 2020 00:04:57 +0000 (01:04 +0100)]
Merge pull request #1973 from mwleeds/avoid-extraneous-summary-copy
Don't copy summary for collection-ref mirror subset pulls
OpenShift Merge Robot [Sat, 28 Mar 2020 17:44:49 +0000 (18:44 +0100)]
Merge pull request #2045 from cgwalters/sysroot-load-err
lib: Add error prefixing for sysroot load and repo open
Matthew Leeds [Thu, 14 Nov 2019 02:30:58 +0000 (18:30 -0800)]
Don't copy summary for collection-ref mirror subset pulls
When we're only pulling a subset of the refs available in the remote, it
doesn't make sense to copy the remote's summary (which may not be valid
for the local repo). This makes the check here match the one done
several lines above when we decide whether to error out if there's no
remote summary available.
This extends the fix in https://github.com/ostreedev/ostree/pull/935 for
the case of collection-refs.
Also, add a unit test for this issue, based on the existing one in
pull-test.sh.
Matthew Leeds [Thu, 14 Nov 2019 02:29:45 +0000 (18:29 -0800)]
find-remotes: Add a --mirror option
This will be useful in the unit test added by the next commit. It just
passes OSTREE_REPO_PULL_FLAGS_MIRROR to the call to
ostree_repo_pull_from_remotes_async().
Colin Walters [Sat, 28 Mar 2020 14:07:00 +0000 (14:07 +0000)]
lib: Add error prefixing for sysroot load and repo open
Noticed this while writing tests for a core `ostree_sysroot_load()`
entrypoint. And decided to do the same for `ostree_repo_open()`,
and while there also noted we had a duplicate error prefixing
for the open (more recently `glnx_opendirat()` automatically
prefixes with the path).
Denis Pynkin [Mon, 23 Mar 2020 12:54:06 +0000 (15:54 +0300)]
ostree-repo: improve error handling
Correctly return "error" from `ostree_repo_sign_commit()`
in case if GPG is not enabled.
Use glnx_* functions in signature related pull code for clear
error handling if GPG isn't enabled.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Thu, 20 Feb 2020 00:59:05 +0000 (03:59 +0300)]
sign-pull: improve error handling
Use glnx_* functions in signature related pull code for clear
error handling.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Thu, 20 Feb 2020 00:24:14 +0000 (03:24 +0300)]
lib/sign: return false for non-implemented functions
Do not mask implementation anymore since we have a working
engines integrated with pulling mechanism.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Wed, 19 Feb 2020 23:43:36 +0000 (02:43 +0300)]
tests/sign: check pull failure with invalid remote options
Pull should to fail if no known signature available in remote's
configuration or well-known places.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Mon, 17 Feb 2020 21:50:21 +0000 (00:50 +0300)]
lib/sign: convert ostree_sign_summary to new style
The "new style" code generally avoids `goto err` because it conflicts
with `__attribute__((cleanup))`. This fixes a compiler warning.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Mon, 17 Feb 2020 21:46:51 +0000 (00:46 +0300)]
sign-dummy: optimize ostree_sign_dummy_data_verify
Return TRUE as soon as any signature verified.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Mon, 17 Feb 2020 21:11:38 +0000 (00:11 +0300)]
sign-
ed25519: Convert functions to new style
The "new style" code generally avoids `goto err` because it conflicts
with `__attribute__((cleanup))`. This fixes a compiler warning.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Fri, 31 Jan 2020 10:00:59 +0000 (13:00 +0300)]
tests/sign: added check with file and single key on pull
Additional test of signatures check behavior during the pull
with keys file containing wrong signatures and correct verification
key. Both are set as a part of remote's configuration.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Colin Walters [Fri, 14 Feb 2020 15:52:48 +0000 (15:52 +0000)]
signing: Remove g_debug(__FUNCTION__)
This type of thing is better done via `gdb` and/or userspace
tracing (systemtap/bpftrace etc.)
Colin Walters [Fri, 14 Feb 2020 14:54:00 +0000 (14:54 +0000)]
sign-dummy: Convert to current code style
This keeps the code style consistent.
Colin Walters [Wed, 29 Jan 2020 14:17:19 +0000 (14:17 +0000)]
sign-
ed25519: Convert some functions to new style
The "new style" code generally avoids `goto err` because it conflicts
with `__attribute__((cleanup))`. This fixes a compiler warning.
Colin Walters [Wed, 29 Jan 2020 14:09:00 +0000 (14:09 +0000)]
build-sys: Print libsodium status at end of configure
Like we do with other features.
Denis Pynkin [Sat, 7 Dec 2019 16:28:41 +0000 (19:28 +0300)]
lib/repo-pull: return errors from signature engines
Improve error handling for signatures checks -- passthrough real
reasons from signature engines instead of using common messages.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Fri, 6 Dec 2019 14:18:04 +0000 (17:18 +0300)]
lib/repo-pull: return error from signing engine
Return the collected errors from signing engines in case if verification
failed for the commit.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Fri, 6 Dec 2019 12:04:14 +0000 (15:04 +0300)]
lib/sign: better error handling of
ed25519 initialization
Add more precise error handling for
ed25519 initialization.
Check the initialization status at the beginning of every public
function provided by
ed25519 engine.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Wed, 4 Dec 2019 20:42:52 +0000 (20:42 +0000)]
lib/sign: make
ed25519 engine non-public
Remove unneeded public declaration for
ed25519 signing engine.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Wed, 4 Dec 2019 20:40:55 +0000 (20:40 +0000)]
lib/sign: make dummy engine non-public
Remove unneeded public declaration for dummy signing engine.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Wed, 27 Nov 2019 13:46:24 +0000 (16:46 +0300)]
bin/pull-local: add --sign-verify-summary
Add option for enabling summary file verification while pulling from local.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Wed, 27 Nov 2019 13:26:54 +0000 (16:26 +0300)]
lib/repo-pull: add signature check while fetching summary
Check the signature of downloaded summary file.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Wed, 27 Nov 2019 13:24:01 +0000 (13:24 +0000)]
lib/repo-pull: set default for sign-verify-summary
Use FALSE as default for summary verification while pulling from remote.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Wed, 27 Nov 2019 13:15:26 +0000 (13:15 +0000)]
lib/repo-pull: change sign supporting functions
Change the API of supporting functions `_load_public_keys()` and
`_ostree_repo_sign_verify()` -- pass repo object and remote name
instead of OtPullData object. This allows to use these functions
not only in pull-related places.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Wed, 27 Nov 2019 09:21:39 +0000 (12:21 +0300)]
gpg: do not fail GPG-related configuration get for remote
We don't need anymore stubs for verification options for remotes
in case if ostree built without GPG support.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Tue, 26 Nov 2019 10:35:30 +0000 (13:35 +0300)]
man: add signature options for ostree summary
Add a description of new options `--sign-type` and `--sign` for
`ostree summary` command.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Tue, 26 Nov 2019 10:01:36 +0000 (13:01 +0300)]
tests/sign: new test for summary file verification
Add test for signature verification of summary file during the pull.
Adopted version of GPG tests from `test-pull-summary-sigs.sh`.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Tue, 26 Nov 2019 09:57:35 +0000 (09:57 +0000)]
lib/repo-pull: verify signature on summary pull
Add signature verification on summary file pulling.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Tue, 26 Nov 2019 09:48:35 +0000 (12:48 +0300)]
bin/summary: add signing with alternative mechanism
Allow to sign the summary file with alternative signing mechanism.
Added new options:
- --sign-type -- select the engine (defaults to
ed25519)
- --sign -- secret key to use for signing
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Tue, 26 Nov 2019 09:44:44 +0000 (12:44 +0300)]
lib/sign: new function for summary file signing
Add function `ostree_sign_summary()` allowing to sign the summary file.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Tue, 26 Nov 2019 09:40:57 +0000 (09:40 +0000)]
tests/sign: allow to start pull test without libsodium
Allow to run the pulling test if there is no
ed25519 support.
Test the signed pull only with dummy engine. Fixed tests names.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Mon, 25 Nov 2019 19:53:28 +0000 (22:53 +0300)]
lib/sign: fix the false failure while loading keys
Usage of 'g_warning()' inside keys loading funcrion lead to false
failure: the key loading attempt for the wrong engine breaks the
pulling process instead of trying to use this key with correct engine.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Mon, 25 Nov 2019 19:50:07 +0000 (19:50 +0000)]
tests/sign: add verification key for pulling with dummy
After splitting out the common key to secret/public inside the dummy engine we
need to pass the the public key for remote with dummy engine usage.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Mon, 25 Nov 2019 19:20:03 +0000 (22:20 +0300)]
lib/sign: use separate public and secret keys for 'dummy'
The initial implementation with single key for secret and public parts
doesn't allow to test pulling with several signing engines used.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Mon, 18 Nov 2019 23:44:16 +0000 (02:44 +0300)]
lib/sign: allow to build with glib version less than 2.44
Ubuntu 14.04 uses glib-2.40 which have no some shiny macroses
for interface declaration.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Mon, 18 Nov 2019 11:28:40 +0000 (14:28 +0300)]
tests/sign: disable GPG for alternatively signed pull
Explicitly disable GPG verification for remote while testing
alternative signing mechanism.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Sun, 17 Nov 2019 18:01:13 +0000 (21:01 +0300)]
tests: use option "--no-sign-verify" for adding remote
Option "--no-sign-verify" disable the signature verification including
GPG. So use it in tests instead of "--no-gpg-verification".
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Sun, 17 Nov 2019 17:58:33 +0000 (20:58 +0300)]
bin/remote-add: added "--no-sign-verify" option
Option "--no-sign-verify" disable the signature verification while
adding remote.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Sun, 17 Nov 2019 17:17:27 +0000 (20:17 +0300)]
tests/local-pull: test "--sign-verify" option
Ensure what with this option only signed commit is pulled.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Sun, 17 Nov 2019 17:15:46 +0000 (20:15 +0300)]
tests/sign: use library functions for
ed25519 keys
Switch to library functions usage.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Sun, 17 Nov 2019 17:02:13 +0000 (20:02 +0300)]
tests/libtest: add functions for
ed25519 tests
Add functions for keys generation to be used in signing-related tests:
- gen_ed25519_keys initializing variables ED25519PUBLIC, ED25519SEED and
ED25519SECRET with appropriate base64-encoded keys
- gen_ed25519_random_public print a random base64 public key (used in
tests with wrong keys)
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Sun, 17 Nov 2019 16:58:29 +0000 (19:58 +0300)]
bin/pull-local: add --sign-verify
Add option for enabling verification while pulling from local.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Sun, 10 Nov 2019 16:17:58 +0000 (19:17 +0300)]
man: document commit signing
Added options descriptions for `ostree-commit` allowing
to sign the commit.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Sun, 10 Nov 2019 13:51:23 +0000 (16:51 +0300)]
apidoc: add API documentation for signing interface
Add the documentation for all public functions.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Fri, 1 Nov 2019 00:00:13 +0000 (03:00 +0300)]
bash-completion: add completion for `ostree sign`
Add bash completion with supported options for signing command.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Thu, 31 Oct 2019 23:44:25 +0000 (02:44 +0300)]
man: document `ostree sign`
Add man page for `ostree sign`.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Tue, 29 Oct 2019 19:23:55 +0000 (22:23 +0300)]
tests/sign: check system-wide config and revoked keys
Extend the
ed25519 tests with checking the system-wide directory
keys loading code(with the help of redefinition).
Added test of
ed25519 revoking keys mechanism.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Tue, 29 Oct 2019 19:16:09 +0000 (22:16 +0300)]
builtin/sign: add option 'keys-dir'
Option '--keys-dir' is used for redefinition of default directories with
public/revoked keys. If keys directory is set then default directories
are ignored and target directory is expected to contain following
structure for
ed25519 signature mechanism:
dir/
trusted.
ed25519 <- file with trusted keys
revoked.
ed25519 <- file with revoked keys
trusted.
ed25519.d/ <- directory with files containing trusted keys
revoked.
ed25519.d/ <- directory with files containing revoked keys
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Sun, 27 Oct 2019 20:15:10 +0000 (23:15 +0300)]
lib/sign: add revoking mechanism for
ed25519 keys
Skip public keys verification if key is marked as invalid key.
Allow to redefine system-wide directories for
ed25519 verification.
Minor bugfixes.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Sun, 27 Oct 2019 19:45:48 +0000 (19:45 +0000)]
lib/sign: add ostree_seign_clear_keys function
Add the function for implicit cleanup of all loaded keys.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Sun, 27 Oct 2019 18:21:21 +0000 (21:21 +0300)]
lib/sign: minor optimisation for
ed25519
Exclude unneeded conversion while load keys from files.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Mon, 7 Oct 2019 22:55:25 +0000 (01:55 +0300)]
sign: use common function for loading public keys during pulling
Add function `_load_public_keys()` to pre-load public keys according
remote's configuration. If no keys configured for remote, then use
system-wide configuration.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Mon, 7 Oct 2019 20:37:08 +0000 (23:37 +0300)]
lib/sign: allow to add keys as base64 string for
ed25519
Allow to add public and secret key for
ed25519 module as based64 string.
This allows to use common API for pulling and builtins without knowledge
of used signature algorithm.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Sun, 6 Oct 2019 23:59:15 +0000 (02:59 +0300)]
lib/sign: public API optimisation
Removed from public `ostree_sign_detached_metadata_append` function.
Renamed `metadata_verify` into `data_verify` to fit to real
functionality.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Sun, 6 Oct 2019 20:40:04 +0000 (23:40 +0300)]
lib/sign-
ed25519: cleanup unneeded code
Removed unused code.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Thu, 5 Sep 2019 13:33:52 +0000 (16:33 +0300)]
builtin/sign: allow to use multiple public keys for verification
`ostree sign` is able to use several public keys provided via arguments
and via file with keys.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Wed, 4 Sep 2019 23:04:25 +0000 (02:04 +0300)]
sign: fix memory leaks and code cleanup
Return `const char *` instead of copy of the string -- this allow to
avoid unneeded copying and memory leaks in some constructions.
Minor code cleanup and optimisations.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Thu, 29 Aug 2019 21:54:17 +0000 (00:54 +0300)]
tests/gpg: skip test in JS if GPG is not supported
Skip the single JS test which throws an error if GPG support
is disabled in a build time.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Wed, 28 Aug 2019 01:21:22 +0000 (04:21 +0300)]
builtin/sign: allow to sign with keys from secret file
Read keys from secret file provided by `--keys-file=` option.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Wed, 28 Aug 2019 00:16:22 +0000 (03:16 +0300)]
lib/sign: read
ed25519 public keys from well known places
If not provided key of file name with keys for remote, then try to use
system defaults:
- /etc/ostree/trusted.
ed25519
- /etc/ostree/trusted.
ed25519.d/*
- /usr/share/ostree/trusted.
ed25519
- /usr/share/ostree/trusted.
ed25519.d/*
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Mon, 26 Aug 2019 21:51:20 +0000 (00:51 +0300)]
lib/sign: add support of file with valid keys for remote
Allow to use custom file with public keys for remote.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Mon, 26 Aug 2019 21:28:44 +0000 (00:28 +0300)]
lib/sign: disable mandatory signature check
Do not check the signature check by default.
Need to enable it explicitly.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Mon, 26 Aug 2019 19:11:32 +0000 (22:11 +0300)]
tests/sign: add initial test for pulling
Test if we pull signed commits from remote.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Mon, 26 Aug 2019 19:08:10 +0000 (22:08 +0300)]
sign: check signatures for pulled commits
If `verification-key` is set for remote it is used as a public key for
checking the commit pulled from that remote.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Mon, 26 Aug 2019 18:59:34 +0000 (21:59 +0300)]
sign: fixes for
ed25519 for loading public keys from files
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Mon, 26 Aug 2019 18:55:53 +0000 (21:55 +0300)]
builtin/sign: remove libsodium dependency
Now do not need to compile/link builtin with external dependencies.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Mon, 26 Aug 2019 18:51:03 +0000 (21:51 +0300)]
sign: fix error return for dummy module
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Mon, 26 Aug 2019 18:47:10 +0000 (21:47 +0300)]
sign: fix unneeded objects creation
Do not create objects just for supported modules list.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Mon, 19 Aug 2019 21:56:27 +0000 (00:56 +0300)]
builtin/sign: remove libsodium-specific code
Use only common sign API without libsoduim parts.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Sun, 18 Aug 2019 23:49:50 +0000 (02:49 +0300)]
tests/sign: check public keys load from file
Test
ed25519 public keys load from file and verify signed commit
against that file.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Sun, 18 Aug 2019 23:47:45 +0000 (02:47 +0300)]
builtin/sign: allow to provide the file with public keys
Added option `--keys-file` for `ostree sign`.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Fri, 9 Aug 2019 19:07:57 +0000 (22:07 +0300)]
sign: API changes for public keys and CLI keys format
API changes:
- added function `ostree_sign_add_pk()` for multiple public keys using.
- `ostree_sign_set_pk()` now substitutes all previously added keys.
- added function `ostree_sign_load_pk()` allowed to load keys from file.
- `ostree_sign_ed25519_load_pk()` able to load the raw keys list from file.
- use base64 encoded public and private
ed25519 keys for CLI and keys file.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Thu, 1 Aug 2019 23:20:33 +0000 (02:20 +0300)]
tests: add test for commits sign/verification
Add tests checking:
- sign mechanism is in working state
- module 'dummy' is able to sign/verify commit
- module '
ed25519' is able to sign/verify commit
- both modules could be used for the same commit
- 'ostree sign' builtin works with commits
- 'ostree commit' builtin able to sign commits
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Thu, 1 Aug 2019 23:16:56 +0000 (02:16 +0300)]
lib/sign: enable verification for pulling
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Wed, 31 Jul 2019 01:00:19 +0000 (04:00 +0300)]
sign: allow to sign commits from CLI
Add signing ability to commit builtin.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Tue, 30 Jul 2019 22:13:48 +0000 (01:13 +0300)]
sign: add new builtin for signing
This builtin allows to sign and verify commit with new signature
mechanism. At the moment it is possible to use 'dummy' and '
ed25519'
signing modules.
'dummy' module use any ASCII string from command line as a key for
commit's signing or verification.
Support of
ed25519 signature is implemented with `libsoium` library.
Secret and public key should be provided in hex presentation via
command line.
Based on 'gpg-sign' source.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Sun, 28 Jul 2019 23:32:28 +0000 (02:32 +0300)]
lib/sign: initial implementation
Added the initial version of signing interface allowing to allowing to
sign and verify commits.
Implemented initial signing modules:
- dummy -- simple module allowing to sign/verify with ASCII string
-
ed25519 -- module allowing to sign/verify commit with
ed25519
(EdDSA) signature scheme provided by libsodium library.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
Denis Pynkin [Sat, 15 Jun 2019 17:10:47 +0000 (20:10 +0300)]
Add libsodium dependency
Allow to configure with libsodium flag.
Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
OpenShift Merge Robot [Tue, 24 Mar 2020 19:06:55 +0000 (20:06 +0100)]
Merge pull request #2041 from cgwalters/auto-sepolicy
repo/commit: Add support for --selinux-policy-from-base